

import request from "../utils/request";

export const categories = () => request.get("/categories");

// 获取商品详情
export const getDetail = (id: number | string) => request.get(`/goods/detail/${id}`);

// 添加至购物车
export const add2Car = (params: any): any => request.post(`shop-cart`, params);

// 获取购物车列表
export const getCar = (): any => request.get(`shop-cart`);

// 从购物车删除
export const delGoodItem = (id: number): any => request.delete(`/shop-cart/${id}`);

// 获取购物车列表
export const getByCartItemIds = (params: any): any => request.get('/shop-cart/settle', { params });

// 创建订单
export const createOrder = (params: any): any => request.post('/saveOrder', params);

// 支付
export const payOrder = (params: any): any => request.get('/paySuccess', { params });

// 获取订单列表
export const getOrderList = (params: any): any => request.get('/order', { params });

// 获取订单详情
export const getOrderDetail = (id: any): any => request.get(`/order/${id}`);

// 取消订单
export const cancelOrder = (id: any): any => request.put(`/order/${id}/cancel`);

